<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .grandFa {
            height: 800px;
            width: 300px;
            background-color: lightseagreen;
        }
        .father {
            height: 500px;
            background-color: lightsalmon;
            padding: 50px;
        }
    </style>
</head>
<body>
    <div>
        爷爷
        <div>
            父亲
            <div class="son">儿子</div>
        </div>
    </div>
    <script>
        var sonEle = document.querySelector(".son");
        var fatherEle = sonEle.parentElement ;      
        fatherEle.className = "father"
        console.log(fatherEle);
        var grandFa = sonEle.parentElement.parentNode ; 
        console.log(grandFa);
        grandFa.className = "grandFa" ; 
        // 这里父元素和父节点一样，可以混用
    </script>
</body>
</html>